<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
<meta charset="utf-8">
<title>系统管理-网站链接</title>
<link href="../c/base.css" rel="stylesheet" type="text/css">
<link href="../c/toefl.css" rel="stylesheet" type="text/css">
<link href="../c/bootstrap.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../j/jquery-2.1.0.js"></script>
<script type="text/javascript" src="../j/bootstrap.min.js"></script>
<script type="text/javascript" src="../j/lrtk.js"></script>

	<link href="../j/ligerUI/skins/Aqua/css/ligerui-dialog.css" rel="stylesheet" type="text/css" />  
	<script src="../j/ligerUI/js/core/base.js" type="text/javascript"></script>
	<script src="../j/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
	<script src="../j/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
	<script src="../j/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
	<script type="text/javascript" th:inline="none">
	 $(function(){
	    	var boxs = $("input[type='checkbox'][id^='box_']");
	    	
	    	$("#checkAll").click(function() {
				boxs.prop("checked", this.checked);
			})
	    	
	 	   $("#delete").click(function(){
	 		   /** 获取到用户选中的复选框  */
	 		   var checkedBoxs = boxs.filter(":checked");
	 		   if(checkedBoxs.length < 1){
	 			   $.ligerDialog.error("请选择一个需要删除的链接！");
	 			  
	 		   }else{
	 			   var ids = checkedBoxs.map(function(){
	 				   return this.value;
	 			   })
	 			   
	 			   $.ligerDialog.confirm("确认要删除吗?","删除链接",function(r){
	 				   if(r){
	 					  window.location = "delLinks?ids=" + ids.get();
	 				   }
	 			   });
	 		   }
	 	   })
	 	   
	    })
	    
	    function schLink(pageNum){
		 $("#pageNum").val(pageNum);
		 $("#schLinkForm").submit();
	 }
	</script>

</head>

<body>

<div class="doc1180 paddingT20 fn-clear">
  <div class="myPost_Theme" style="height: 80vh;">
  				<form action="/getLinks" class="form-inline" id="schLinkForm">
					<input type="hidden" name="pageNum" id="pageNum" value="${schLink.pageNum}">
				</form>
            	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myPost_Table">
                  <tr class="myPost_Th">
                  	<th><input type="checkbox" name="checkAll" id="checkAll" /></th>
                    <th >连接名称</th>
                    <th>连接地址</th>
                    <th>连接描述</th>
                    <th>相关单位</th>
                    <th>创建日期</th>
                  </tr>
                  <tr th:each="l,lStatus:${pageInfo.list}">
                  	<td><input type="checkbox" th:id="'box_'+${lStatus.index}" th:value="${l.link_id}" /></td>
                    <td th:text="${l.link_name}" class="myPost_ThemeTitle">新浪新闻</td>
                    <td th:text="${l.link_url}">www.sina.new.com</td>
                    <td th:text="${l.link_desc}">
                    	新浪首页的信息
                    </td>
                    <td th:text="${l.relate_unit}">腾讯公司</td>
                    <td th:text="${#dates.format(l.create_time,'yyyy-MM-dd')}">2001-01-01</td>
                  </tr>
                  
                  
				</table>
				<div class="pageList" style="width: 500px;float: right;">
					<ul>
						<li th:each="n:${pageInfo.navigatepageNums}">
							<a href="###" th:onclick="schLink([[${n}]]);">[[${n}]]</a>
						</li>
						
						<li th:unless="${pageInfo.isFirstPage}">
							<a href="###" th:onclick="schLink(1);">首页</a>
						</li>
						<li th:if="${pageInfo.hasPreviousPage}">
							<a href="###" th:onclick="schLink([[${pageInfo.prePage}]]);" class="pret">上一页</a>
						</li>
						<li th:if="${pageInfo.hasNextPage}">
							<a href="###" th:onclick="schLink([[${pageInfo.nextPage}]]);" class="next">下一页</a>
						</li>
						<li th:unless="${pageInfo.isLastPage}">
							<a href="###" th:onclick="schLink([[${pageInfo.pages}]]);">尾页</a>
						</li>
					</ul>
				</div>
				
				
				<div id="" class="" style="margin-top: 40px;">
					<a href="#" class="btn btn-success" data-toggle="modal" data-target=".modal">创建</a>
					<!-- <a href="#" class="btn btn-warning" data-toggle="modal" data-target=".modal">编辑</a> -->
					<input id="delete" type="button" class="btn btn-danger" value="删除"/>
				</div>
            </div>
  
</div>

<!--表单元素-->
<div class="modal fade" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">连接信息</h4>
      </div>
      <form action="/addLink" method="post">
      	<div class="modal-body">
        	
			  <div class="form-group">
			    <label>连接名称</label>
			    <input name="link_name" type="text" class="form-control"  placeholder="名称">
			  </div>
			  <div class="form-group">
			    <label >连接地址</label>
			    <input name="link_url" type="text" class="form-control"  placeholder="地址">
			  </div>
			  
			  <div class="form-group">
			    <label >相关单位</label>
			   	<input name="relate_unit" type="text" class="form-control"  placeholder="相关单位">
			  </div>
			  <div class="form-group">
			    <label >描述</label>
			   	<textarea name="link_desc" rows="5" cols="" class="form-control"></textarea>
			  </div>
			
        
      	</div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	        <button type="submit" class="btn btn-primary">保存</button>
	      </div>
      </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- 代码结束 -->
</body>
</html>
